Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-sanitize

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-sanitize

AngularJS module for sanitizing HTML

  • 1.8.3
  • next
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
198K
increased by4.95%
Maintainers
1
Weekly downloads
 
Created

What is angular-sanitize?

The angular-sanitize package is an AngularJS module that provides functionality to sanitize HTML content. It helps in preventing cross-site scripting (XSS) attacks by cleaning up the HTML content before it is displayed in the application.

What are angular-sanitize's main functionalities?

Sanitize HTML Content

This feature allows you to sanitize HTML content to prevent XSS attacks. The code sample demonstrates how to use the $sce service to trust HTML content and bind it to the scope.

angular.module('myApp', ['ngSanitize'])
  .controller('myController', ['$scope', '$sce', function($scope, $sce) {
    $scope.htmlContent = $sce.trustAsHtml('<p style="color:blue">Hello World</p>');
  }]);

Bind HTML Content to View

This feature allows you to bind sanitized HTML content to the view using the ng-bind-html directive. The code sample shows how to bind the trusted HTML content to a div element.

<div ng-app="myApp" ng-controller="myController">
  <div ng-bind-html="htmlContent"></div>
</div>

Other packages similar to angular-sanitize

Keywords

FAQs

Package last updated on 07 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc